<div class="navbar navbar-inverse navbar-fixed-top">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
            <a class="navbar-brand" href="/">Home</a>
        </div>
        <div class="navbar-collapse collapse">
            <ul class="nav navbar-nav">
                <li>
                    <a href="/">主页</a>
                </li>
                <!-- <li>
                    <a href="/category">分类</a>
                </li> -->
                {% for item in categorys %}
                <li>
                  <a href="/article/{{ item.id }}">{{ item.title }}</a>
                </li>
                {% endfor %}
                <li>
                    <a href="/about">关于</a>
                </li>
            </ul>
            {% if user %}
            <ul class="nav navbar-nav navbar-right">
                <li role="presentation" class="dropdown">
                   <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true"
                     aria-expanded="false">
                    <i class="glyphicon glyphicon-user"></i> {{ user.name }} 你好！ <span class="caret"></span>
                   </a>
                   <ul class="dropdown-menu">
                      <li>
                        <a href="/admin/user/profile">个人信息</a>
                      </li>
                      <li>
                        <a href="/admin/user/password">修改密码</a>
                      </li>
                       <li>
                         <a href="/account/logout" onClick="return confirm('确定要注销吗?');">安全退出</a>
                       </li>
                   </ul>
                 </li>
                <li>
                  <a href="/admin"><i class="glyphicon glyphicon-cog"></i> 管理</a>
                </li>
            </ul>
            {% else %}
            <ul class="nav navbar-nav navbar-right">
                <li>
                    <a class="loginLink" href="/account/login">登录</a>
                </li>
            </ul>
            {% endif %}
        </div>
    </div>
</div>